# CMakeLists.txt 示例
cmake_minimum_required(VERSION 3.14)
project(trace_system_tests)


set(CMAKE_CXX_STANDARD 14)
set(CMAKE_BUILD_TYPE Debug)
set(PROJECT_BINARY_DIR "/home/ubuntu/services/trace_system/mock")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)


find_package(GTest REQUIRED)
find_package(ppconsul REQUIRED)
# 查找 glog（需要先安装 glog）
find_package(glog REQUIRED)


# 包含 glog 头文件目录
include_directories(${GLOG_INCLUDE_DIRS})

file(GLOB SDK_SOURCES /home/ubuntu/services/trace_system/sdk/*.cpp)
file(GLOB SDK_HEADERS /home/ubuntu/services/trace_system/sdk/*.hpp)



file(GLOB SOURCE_FILES "/home/ubuntu/services/trace_system/mock/*.cpp")

foreach(SOURCE_FILE ${SOURCE_FILES})
    get_filename_component(EXEC_NAME ${SOURCE_FILE} NAME_WE) 
    add_executable(${EXEC_NAME} 
                        ${SOURCE_FILES}  
                        ${SDK_HEADERS} 
                        ${SDK_SOURCES})
    target_link_libraries(${EXEC_NAME}  gtest gtest_main pthread ppconsul glog gflags)
endforeach()

